<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<%@include file="/WEB-INF/jsp/base/head.jsp"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head> 

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编码管理列表</title>
</head>
<body>
	<s:form id="form1" namespace="/code" action="codeAction!getCodeList" name="form1" method="post">
	
	<input type="hidden" id="addURL" value="codeAction!getCodeAdd.do"/>
	<input type="hidden" id="delURL" value="codeAction!codeDelete.do"/>
	<input type="hidden" id="editURL" value="codeAction!getCodeEdit.do"/>
	
	<div class="center_main">
		 <div id="btn-option">
			<a class="add-btn"  id="add" 		href="javascript:void(0);" title="新增">新增</a>
			<a class="edit-btn" id="edit"       href="javascript:void(0);" title="修改">修改</a>
			<a class="del-btn"  id="delete"     href="javascript:void(0);" title="删除">删除</a>
		</div>
		<div class="center_left"></div>
	</div>
	<div id="page-top">
		<span>编码管理列表</span>
		<b></b><i></i>
	</div>
  
	<div id="page"> 
       
            <div id="search">
       
	       		<div class="search-edit-wapper">
					<label for="">编码类别：</label>
					<s:select list="%{codeNameList}" name="codeBizBean.codeName" headerKey="codeBizBean.codeKey" headerValue="全部"/>
				</div>
				
				<div class="search-edit-wapper">
					<label for="">编码备注：</label><input type="text" class="inputText" name="codeBizBean.remark" value="${codeBizBean.remark}" />
				</div>
				
				<div class="search-edit-wapper">
					<label for="">编码备注：</label>
					<select name="codeBizBean.remark1" style="width:200px;">
						<option value="">请选择</option>
						<s:iterator value="%{codeRemarkList}" status="sta">
							<option <s:if test="%{codeRemarkList[#sta.index]==codeBizBean.remark1}">selected</s:if> value="${codeRemarkList[sta.index]}" style="width:300px;">${codeRemarkList[sta.index]}</option>
						</s:iterator>
					 </select>
				</div>
				<div class="search-edit-wapper" style="margin-left: 90px;">
					<b>编码排序：</b><input type="text" id="orderBy" name="codeBizBean.orderBy" value="${codeBizBean.orderBy}" style="width:40px;" maxlength="8" onkeyup="this.value=this.value.replace(/\D/g,'')" />
					<input type="button" id="updateCodeOrderBy"  value="确认排序" style="margin-left: 10px;background: #000;color: #fff;padding: 2px 10px;border: none;"/>
				</div>
			</div>
			
			<div id="search-btn-wapper">
				<s:submit cssClass="btn"  method="getCodeList" value="查询"></s:submit>
			</div>
            
            <div id="item-list">
				<table>
				   <thead>
				     <tr>
						<th>选择<input type="checkbox" id="selectAll" /></th>
						<th>编码名称</th>
						<th>键名</th>
						<th>键值</th>
						<th>序号(排序)</th>
						<th>描述</th>
					 </tr>
				   </thead>
				   <tbody>
						<s:iterator value="codeBizBeans" status="sta">
						<tr>
							<td><input type="checkbox" class="classCheckbox" name="codeBizBeans[${sta.index}].codeId" value="${codeId }" /></td>
							<td>${codeName }</td>
							<td>${codeKey }</td>
							<td>${codeValue }</td>
							<td>${orderBy }</td>
							<td>${remark }</td>
						</tr>
						</s:iterator>
						<s:if test="codeBizBeans.size == 0">
						    <tr>
						       <td colspan="6"><span class="spanRB">数据暂无!</span></td>
						    </tr>
						</s:if>
					</tbody>
				</table>
			</div>
    </div>
    </s:form>
    <div id="page-bottom">
    	<b></b><i></i>
		<d:page namespace="/code" action="codeAction!getCodeList">
			<d:param name="codeBizBean.codeName" value="${codeBizBean.codeName }"></d:param>
           	<d:param name="codeBizBean.remark" value="${codeBizBean.remark }"></d:param>
		</d:page>
	</div>
</body>
<script type="text/javascript">
$(function(){
	
	$("#updateCodeOrderBy").click(function(){
		var array=$("input[type='checkbox']:checked");
		if(array.length == 0){
			alert("请选择一条数据！");
			return false;			
		} else if(array.length == 1){
			if($("#orderBy").val().length == 0){
				alert("请输入您要排列的位置！");
				document.getElementById("orderBy").focus();
				return false;
			}
			$("#form1").attr("action","codeAction!updateCodeOrderBy.do");
			$("#form1").submit();
		} else {
			alert("只能选择一条数据！");
			return false;	
		}
	});
});
</script>
</html>